package com.iwhalecloud.bss.kite.cucc.order.accept.constructor;

import com.iwhalecloud.bss.kite.cucc.order.accept.constructor.inst.InstConstructor;
import com.iwhalecloud.bss.kite.cucc.order.accept.constructor.inst.OfferInstAcctRelConstructor;
import com.iwhalecloud.bss.kite.cucc.order.accept.constructor.inst.OfferInstAssureExtConstructor;
import com.iwhalecloud.bss.kite.cucc.order.accept.constructor.inst.OfferInstConstructor;
import com.iwhalecloud.bss.kite.cucc.order.accept.constructor.inst.OfferObjInstRelConstructor;
import com.iwhalecloud.bss.kite.cucc.order.accept.constructor.inst.OfferProdInstRelConstructor;
import com.iwhalecloud.bss.kite.cucc.order.accept.constructor.inst.OfferResInstRelExtConstructor;
import com.iwhalecloud.bss.kite.cucc.order.accept.constructor.inst.ProdInstAcctRelConstructor;
import com.iwhalecloud.bss.kite.cucc.order.accept.constructor.inst.ProdInstConstructor;
import com.iwhalecloud.bss.kite.cucc.order.accept.constructor.inst.ProdInstFuncConstructor;
import com.iwhalecloud.bss.kite.cucc.order.accept.constructor.inst.ProdInstRelConstructor;
import com.iwhalecloud.bss.kite.cucc.order.accept.constructor.inst.ProdInstStateConstructor;
import com.iwhalecloud.bss.kite.cucc.order.accept.constructor.inst.RelConstructor;
import com.iwhalecloud.bss.kite.cucc.order.accept.constructor.inst.SubProdInstConstructor;
import com.iwhalecloud.bss.kite.dataservice.entity.inst.IInst;
import com.iwhalecloud.bss.kite.manager.enums.InstType;
import com.iwhalecloud.bss.kite.manager.enums.RelType;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;

import java.util.HashMap;
import java.util.Map;

/**
 * 数据构造器类型映射配置
 */
public abstract class ConstructorTypeMap {

    /**
     * 实例构造器映射
     */
    private static Map<InstType, Class<? extends InstConstructor<? extends KiteInst, ? extends IInst>>> instMap = new HashMap<>();

    /**
     * 关系构造器映射
     */
    private static Map<String, Class<? extends RelConstructor<? extends IInst>>> relMap = new HashMap<>();

    static {
        instMap.put(InstType.GIFT_OFFER_INST, OfferInstConstructor.class);
        instMap.put(InstType.MAIN_OFFER_INST, OfferInstConstructor.class);
        instMap.put(InstType.ADDITIONAL_OFFER_INST, OfferInstConstructor.class);
        instMap.put(InstType.PROMOTION_OFFER_INST, OfferInstConstructor.class);
        instMap.put(InstType.PROD_INST, ProdInstConstructor.class);
        instMap.put(InstType.PROD_INST_FUNC, ProdInstFuncConstructor.class);
        instMap.put(InstType.MKT_RES_INST, OfferResInstRelExtConstructor.class);
        instMap.put(InstType.PROD_INST_ACCT, ProdInstAcctRelConstructor.class);
        instMap.put(InstType.PROD_INST_STATE, ProdInstStateConstructor.class);
        instMap.put(InstType.OFFER_INST_ASSURE, OfferInstAssureExtConstructor.class);
        instMap.put(InstType.SUB_PROD_INST, SubProdInstConstructor.class);
        instMap.put(InstType.OFFER_INST_ACCT, OfferInstAcctRelConstructor.class);


        relMap.put(RelType.OFFER_OBJ_REL_TYPE, OfferObjInstRelConstructor.class);
        relMap.put(RelType.PROD_REL_TYPE, ProdInstRelConstructor.class);
        relMap.put(RelType.OFFER_PROD_REL_TYPE, OfferProdInstRelConstructor.class);
    }

    public static Map<InstType, Class<? extends InstConstructor<? extends KiteInst, ? extends IInst>>> getInstMap() {
        return instMap;
    }

    public static void setInstMap(
        Map<InstType, Class<? extends InstConstructor<? extends KiteInst, ? extends IInst>>> instMap) {
        ConstructorTypeMap.instMap = instMap;
    }

    public static Map<String, Class<? extends RelConstructor<? extends IInst>>> getRelMap() {
        return relMap;
    }

    public static void setRelMap(Map<String, Class<? extends RelConstructor<? extends IInst>>> relMap) {
        ConstructorTypeMap.relMap = relMap;
    }
}
